import HTTP from '../../axios/http';

export default function login (params) {
  console.log('params', params)
  return function (dispatch) {
    return HTTP.post("/user/login", params).then(res => {
      if (res.data.code === 0) {
        dispatch({
          type: "LOGIN",
          user: params.username
        });
      }
      return res.data;
    })
  }
}